package reflect;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.lang.reflect.Method;
import java.util.Scanner;

/**
 * JAVA 反射机制
 * 反射是java的动态机制，它允许我们再程序[运行期间]
 */
public class ReflectDemo1 {
    public static void main(String[] args) throws ClassNotFoundException {
        //Class cls = String.class; // 获取String的类对象
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入完全限定的类名：");
        String s = sc.nextLine();

        String name = Class.forName(s).getName();
        System.out.println(name);
        String simpleName =Class.forName(s).getSimpleName();
        System.out.println(simpleName);
      Method[] methods =  Class.forName(s).getMethods();
      for (Method  method : methods){
          System.out.println(method.getName());
          System.out.println("-------");
      }



    }

}
